<?php
/**
 * Created by PhpStorm.
 * User: 魏国荣
 * Date: 2019/2/23
 * Time: 8:57
 */
namespace App\Services\Register;

use App\Services\CommonService;
use Illuminate\Support\Facades\DB;
use App\Model\Usera;
class RegisterService extends CommonService
{
    public $usera;
    public function __construct()
    {
        $this->usera = new Usera();
    }
    /*查询数据库中的手机号是否存在*/
    public function isPhone($phone)
    {
        return $this->usera->isPhone($phone);
/*        $sql = DB::select("select `id`,`phone` from usera where phone='$phone'");
        $res = array_map('get_object_vars',$sql);
        return $res;*/
    }
    /*添加注册信息*/
    public function addUser($phone,$pwd,$time)
    {
        return $this->usera->addUser($phone,$pwd,$time);
        /*$sql = DB::insert("insert into usera (phone,password,created_at) values ('$phone','$pwd','$time')");
        return $sql;*/
    }

    /*查询用户是否存在-->登录*/
    
    public function haveUser($phone,$pwd)
    {
        return $this->usera->haveUser($phone,$pwd);
       /* $sql = DB::select("select `phone`,`tag_id` from usera where phone='$phone' and password='$pwd'");
        $res = array_map('get_object_vars',$sql);
        return $res;*/
    }

   /* 修改用户信息-->忘记密码*/

    public function forgetInfo($pwd,$id)
    {
        return $this->usera->forgetUser($pwd,$id);
    }

}